package com.hhx.baselibrary.api;

/**
 *
 */

public class API {

    private static final String baseUrl = "https://api.haominglijia.com/";
//   https://www.showdoc.cc/206118952023103
    //接口地址：地址：http://101.132.178.144
    //后台管理地址
    //http://admin.haominglijia.com
    //密码 账号 admin admin


/*    private volatile static ApiService apiService;

    public static ApiService getApiService() {
        if (apiService == null) {
            synchronized (API.class) {
                if (apiService == null) {
                    new API();
                }
            }
        }
        return apiService;
    }

    private API() {
        RetrofitManager baseApi = new RetrofitManager();
        apiService = baseApi.getSSLRetrofit(baseUrl).create(ApiService.class);
    }*/

/*    private volatile static ApiService apiService;

    public static ApiService getApiService() {
        apiService = create(ApiService.class);
        return apiService;
    }*/

    public <T> T create(final Class<T> service) {
        if (service == null) {
            throw new RuntimeException("Api service is null!");
        }
        return RetrofitManager.getInstance().getSSLRetrofit(baseUrl).create(service);
    }

    //private ApiService appService;
    private static API api;

    public static API getInstance() {
        if (api == null) {
            synchronized (API.class) {
                if (api == null) {
                    api = new API();
                }
            }
        }
        return api;
    }


/*    public ApiService apiService() {
        appService = create(ApiService.class);
        return appService;
    }*/

    //methoth
/*       API.getInstance()
               .apiService()
                .aboutLiJia(map)
                .subscribeOn(Schedulers.io())
            .observeOn(AndroidSchedulers.mainThread())
            .subscribe(new ProgressLoadingObserver<>(this, new ObserverResponseListener<BaseResp<AboutLiJia>>() {
        @Override
        public void onNext(BaseResp<AboutLiJia> aboutLiJiaBaseResp) {

        }

        @Override
        public void onError(ApiException e) {

        }
    },true,true));*/
}
